package cn.devnotes.servletdemo.util;

import java.util.Properties;

public class AppConfigUtil {
    static Properties properties = null;

    protected static Properties load () {
        if (properties != null) return properties;

        properties = new Properties();
        try {
            properties.load(AppConfigUtil.class.getClassLoader().getResourceAsStream("application.properties"));
        } catch (Exception e) {
            properties = null;
            e.printStackTrace();
        }
        return properties;
    }

    /**
     *
     * @param key
     * @return
     */
    public static String get (String key) {
        load();
        return properties.getProperty(key);
    }
}
